package pl.pollub.medikit.client.callbacks;

import pl.pollub.medikit.client.Medikit;

import com.google.gwt.user.client.rpc.AsyncCallback;

public class AuthCallback implements AsyncCallback<Boolean> {
	private Medikit mLogin;
	
	public AuthCallback(Medikit loginPanel) {
		mLogin = loginPanel;
	}
	
	@Override
	public void onFailure(Throwable caught) {
		caught.printStackTrace();
	}

	@Override
	public void onSuccess(Boolean result) {
		if (result) {
			System.out.println("Valid user");
			mLogin.loginCorrect();
		} else {
			System.out.println("Invalid user");
			mLogin.loginError();
		}
	}

}
